
import request from '@/utils/request'

/**
 * 查询企业部门列表
 * @param {*} params
 * @returns
 */
export function getDepartments() {
  return request({
    url: '/company/department',
    method: 'get'
  })
}

/**
 * 新增部门
 * @param {code,introduce,manager,name,pid} params
 * @returns
 */
export function addDepartments(data) {
  return request({
    url: '/company/department',
    method: 'post',
    data
  })
}

/**
 * 根据id修改部门
 * @param {code,introduce,manager,name,pid,id} params
 * @returns
 */
export function updateDepartments(data) {
  return request({
    url: `/company/department/${data.id}`,
    method: 'put',
    data
  })
}

/**
 * 根据id删除部门
 * @param {id} params
 * @returns
 */
export function delDepartments(id) {
  return request({
    url: `/company/department/${id}`,
    method: 'delete'
  })
}

/**
 * 根据id查询部分部门
 * @param {id} params
 * @returns
 */
export function idDepartments(id) {
  return request({
    url: `/company/department/${id}`
  })
}
